<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
	<script src="jquery-1.8.3.min.js"></script>
</head>
<body>
<input type="button" id="all" value="全选">
<input type="button" id="unall" value="全不选">
<input type="button" id="fan" value="反选">
<hr>
<input type="checkbox">HTML
<br>
<input type="checkbox">CSS
<br>
<input type="checkbox">PHP
<br>
<input type="checkbox">MYSQL
<br>
<input type="checkbox">JAVA
<br>
<input type="checkbox">C/C++
<br>
<input type="checkbox">PYTHON
<br>
<script>
	$.fn.extend({
		all:function () {
			this.attr('checked',true);
		},
		unall:function () {
			this.attr('checked',false);
		},
		fan:function () {
			for (var i = 0; i<this.length;i++){
				if (this[i].checked == true){
					this[i].checked = false
				}else {
					this[i].checked = true
				}
			}

		}
	});

	$("#all").click(function () {
		$(":checkbox").all();
	})

	$("#unall").click(function () {
		$(":checkbox").unall();
	})

	$("#fan").click(function () {
		$(":checkbox").fan();
	})
</script>
</body>
</html>